<?php

namespace AdminPanel\ContentBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ContentType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $isActiveChoiceArray = array(0=>'Үгүй', 1=>'Тийм');
        $builder
//            ->add('category_id')
            ->add('content_title', 'text', array(
                'label' => 'Контентын гарчиг',
                'required' => true
            ))
            ->add('content_body', 'textarea', array(
                'label' => 'Контентын эх',
                'required' => true
            ))
            ->add('slug', 'text', array(
                'label' => 'URL'
            ))
            ->add('img_thumb', 'text', array(
                'label' => 'Зураг жижиг',
                'required' => false
            ))
            ->add('img_large', 'text', array(
                'label' => 'Зураг том',
                'required' => false
            ))
            ->add('is_active', 'choice', array(
              'label' => 'Идэвхитэй эсэх',
              'choices' => $isActiveChoiceArray,
              'required' => true,
              'expanded' => true,
              'multiple' => false
            ))
            ->add('is_special', 'choice', array(
                'label' => 'Онцлох',
                'choices' => $isActiveChoiceArray,
                'required' => true,
                'expanded' => true,
                'multiple' => false
            ))
            ->add('category', 'entity', array('class' => 'AdminPanel\ContentBundle\Entity\ContentCategory', 'property' => 'categoryName',))
            ->add('menu', 'entity', array('class' => 'AdminPanel\ContentBundle\Entity\Menu', 'property' => 'name_mn',))
            
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AdminPanel\ContentBundle\Entity\Content'
        ));
    }

    public function getName()
    {
        return 'adminpanel_contentbundle_contenttype';
    }
}
